<html>

<head>
    <meta charset="UTF-8">
    <title>插件信息列表</title>
    <link id="easyuiTheme" href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
    <link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
    <link href="../../static/css/esaas-easyui-add.css" rel="stylesheet" type="text/css"/>
    <script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../static/easyui/jquery.cookie.js" type="text/javascript"></script>
    <script src="../../static/easyui/ui-theme.js" type="text/javascript"></script>
    <script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
    <script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
    <script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
    <script src="../../ffres/dict/all.js" type="text/javascript"></script>
    <a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<script type="text/javascript">

    var enname=""
    $(function () {
        addTitle("应用插件选择");
    })

    function onDblClickRow(index,pluginId) {
        window.parent.choosePlugin(pluginId);
        window.parent.JLEUtil.closewin();
    }

    function selectReturn() {
        var row = $('#dg').datagrid('getSelected');
        if (row) {
            onDblClickRow(-1, row.pluginId);
        } else {
            $.messager.alert('提示', '请选择一条记录！', 'info');
        }
    }

    function closeForm() {
        window.parent.JLEUtil.closewin();
    }


    function reloadList(){
        $('#dg').datagrid('reload');
        JLEUtil.closewin();
    };

    //查询列表
    function queryList(id,pluginId){
        if (pluginId==""){
            $('#dg').datagrid({
                queryParams: {
                    pluginCatalog: id,
                }
            });
        }else {
            $('#dg').datagrid({
                queryParams: {
                    pluginCatalog: id,
                    pluginId:pluginId
                }
            });
        }
        $("#dg").datagrid({url:'../../api/plugin/defines'})
    }
    //获取字典项生成树菜单
    function getDic() {
        jsonData={
            opttype:"BAT_PLUGIN_CATALOG"
        }
        $.restfulPostForm("../../api/s/dics",jsonData,function (data) {
            var  treeData="";
            treeData+="[{"
            console.log(data.rows.length)
            for (var i=0;i<data.rows.length;i++) {

                if (i==0){
                    treeData+='"id":"'+data.rows[i].enname+'","text":"'+data.rows[i].cnname+'"}'
                } else {
                    treeData+=',{"id":"'+data.rows[i].enname+'","text":"'+data.rows[i].cnname+'"}'
                }
            }
            treeData+="]"
            //转为json
            treeData =eval("(" + treeData + ")");
            $('#menu_app1').tree({
                data: treeData
            });
        })
    }
    $(function () {
        getDic();
        queryList('01');
        $('#menu_app1').tree({
            onClick: function(node){
                queryList(node.id)
                enname =node.id
            }
        });
    })

</script>

<body class="easyui-layout">
<div data-options="region:'north'" style="height: 28px;" >
    <div class="esaas-info-title2" style="background-color: #205081;" >
        <div style="padding: 2px;"> &nbsp;&nbsp;选择应用插件</div>
        <a class="easyui-menubutton" style="position:absolute;right: 5px;top: 1px;width:22px;height: 22px;background-image: url('../../static/easyui/themes/icons/cancel6.png')" onclick="closeForm()">
        </a>
    </div>
</div>
<div id="1" data-options="region:'west',title:'',split:true" style="width: 220px;">
    <div >
        <ul  class="easyui-tree"  data-options="animate:true,lines:true" id="menu_app1" >

        </ul>
    </div>
</div>
    <div data-options="region:'center',split:false">
        <div data-options="region:'north',title:''" style="height: 35px;">
            <form id="searchForm">
                <table>
                    <tr>
                        <td class="searchTd">&nbsp;插件ID：</td>
                        <td><input name="pluginId" id="pluginId"/></td>
                        <td><a class="easyui-linkbutton" href="javascript:void(0);" onclick=queryList(enname,$('#pluginId').val())>查找</a></td>
                        <td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.clearForm('searchForm');">清空</a></td>
                    </tr>
                </table>
            </form>
        </div>
        <table id="dg" class="easyui-datagrid" title="" style="width:100%;height:94%"
               data-options="singleSelect:true,collapsible:true,url:'../../api/plugin/defines',method:'post'"
               toolbar="#tb" rownumbers="true" >
            <thead>
            <tr>
                <th data-options="field:'pluginId',resizable:true" width="10%">插件ID</th>
                <th data-options="field:'pluginName',resizable:true" width="16%">插件名称</th>
                <th data-options="field:'pluginClass',resizable:true" width="38%">插件实现类</th>
                <th data-options="field:'pluginConfigUrl',resizable:true" width="20%">插件参数配置页面</th>
                <!--<th data-options="field:'pluginCatalog',resizable:true" formatter="formatter_BAT_PLUGIN_CATALOG" width="20%">插件分类</th>-->
                <th data-options="field:'needOtherDsVar',resizable:true" width="16%">需要其它数据源变量</th>
                <th data-options="field:'pluginDesc',resizable:true" width="20%">插件描述</th>
            </tr>
            </thead>
        </table>
    </div>
<div data-options="region:'south',split:false" style="height: 55px;">
    <div style="text-align: center; padding: 10px 0px 25px;height: 10%;">
        <a href="javascript:void(0)" class="easyui-linkbutton"
           onclick="selectReturn()">&nbsp;选择返回&nbsp;</a>
        <a href="javascript:void(0)" class="easyui-linkbutton"
           onclick="closeForm()">&nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;闭&nbsp;&nbsp;</a>
    </div>
</div>
</body>

</html>